package com.lucun.insurance.controller;

import com.lucun.insurance.db.entity.Insure;
import com.lucun.insurance.db.entity.Settlement;
import com.lucun.insurance.service.InsureService;
import com.lucun.insurance.service.SettlementService;
import com.lucun.insurance.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/settlement")
public class SettlementController {
    @Autowired
    SettlementService settlementService;
    //    添加理赔信息
    @RequestMapping("/insert")
    public JsonResult<?> insert(@RequestBody Settlement sett) {
        return settlementService.insert(sett);
    }
    //    查询所有理赔信息
    @RequestMapping("/findAll")
    public List<Settlement> findAll() {
        return settlementService.findAll();
    }
    //   根据申请人id查询
    @RequestMapping("/findById")
    public List<Settlement> findById(@RequestBody Settlement id) {
        return settlementService.findById(id);
    }
      // 根据申请人姓名查询
    @RequestMapping("/findByName")
    public JsonResult<?> findByName(@RequestBody Settlement settlement) {
        return settlementService.findByName(settlement);
    }
    //    根据id删除理赔信息
    @RequestMapping("/delete")
    public JsonResult<?> delete(@RequestBody Settlement sett) {
        return settlementService.delete(sett);
    }
    //根据id修改理赔信息内容
    @RequestMapping("/update")
    public JsonResult<?> update(@RequestBody Settlement sett){
        return settlementService.update(sett);
    }
}
